<?php
declare(strict_types = 1);

namespace app\logic;

use think\exception\HttpException;
use think\facade\Cache;

abstract class BaseLogic
{
    public function getModel($name)
    {
        return app('model')->model($name);
    }

    public function getLogic($name)
    {
        return app('logic')->logic($name);
    }

    public function throwHttpException($code, $message)
    {
        throw new HttpException(200, $message, null, [], $code);
    }

    /**
     * @return \think\cache\Driver
     */
    protected function getRedisCache()
    {
        return Cache::store('redis');
    }
}
